<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:util="http://xmlns.jcp.org/jsf/composite/util">

    <h:form id="educations_form">
        <util:dataTableWrapper title="Lista studii">
            <f:facet name="buttonContent">
                <p:commandButton icon="custom-icon-add" value="Adauga studii"
                                 oncomplete="PF('add_education_WV').show()" update=":create_education_form"
                                 resetValues="true"
                                 actionListener="#{skillsDataBean.resetCreateEducationDialog}"/>
            </f:facet>

            <p:dataTable var="ed" value="#{skillsDataBean.educations}"
                         emptyMessage="Nu a fost gasita nici o inregistrare.">

                <p:column headerText="De baza">
                    <h:outputText value="#{ed.basic}"/>
                </p:column>

                <p:column headerText="Nume institutie">
                    <h:outputText value="#{ed.institutionName}"/>
                </p:column>

                <p:column headerText="Tip studii">
                    <h:outputText value="#{ed.educationType.name}"/>
                </p:column>

                <p:column headerText="Domeniu studii">
                    <h:outputText value="#{ed.educationDomain.name}"/>
                </p:column>

                <p:column headerText="Nume specialite">
                    <h:outputText value="#{ed.specialty}"/>
                </p:column>

                <p:column headerText="Anul absolvirii">
                    <h:outputText value="#{ed.graduationYear}"/>
                </p:column>

                <p:column styleClass="override-icons" headerText="Actions">
                    <p:commandButton icon="custom-icon-edit"
                                     actionListener="#{skillsDataBean.initEditEducationDialog(ed)}"
                                     oncomplete="PF('add_education_WV').show()" update=":create_education_form"/>

                    <p:commandButton icon="custom-icon-delete"
                                     actionListener="#{skillsDataBean.deleteEducation(ed)}"
                                     update="@form">
                        <p:confirm header="Confirma"
                                   message="Sunteti sigur ca doriti stergerea de studii?"
                                   icon="ui-icon-alert"/>
                    </p:commandButton>

                </p:column>
            </p:dataTable>
        </util:dataTableWrapper>
        <p:confirmDialog global="true">
            <p:commandButton value="Da" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check"/>
            <p:commandButton value="Nu" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close"/>
        </p:confirmDialog>
    </h:form>

    <h:form id="languages_form">
        <util:dataTableWrapper title="Lista limbi moderne">
            <f:facet name="buttonContent">
                <p:commandButton icon="custom-icon-add" value="Adauga limba moderna"
                                 oncomplete="PF('add_language_WV').show()" update=":create_language_form"
                                 resetValues="true"
                                 actionListener="#{skillsDataBean.resetCreateLanguageDialog}"/>
            </f:facet>
            <p:dataTable var="ml" value="#{skillsDataBean.modernLanguages}"
                         emptyMessage="Nu a fost gasita nici o inregistrare.">

                <p:column headerText="Limba moderna cunoscuta">
                    <h:outputText value="#{ml.language.name}"/>
                </p:column>

                <p:column headerText="Nivel de cunoastere">
                    <h:outputText value="#{ml.knowledgeLevel.name}"/>
                </p:column>

                <p:column styleClass="override-icons" headerText="Actions">
                    <p:commandButton icon="custom-icon-edit"
                                     actionListener="#{skillsDataBean.initEditLanguageDialog(ml)}"
                                     oncomplete="PF('add_language_WV').show()" update=":create_language_form"/>

                    <p:commandButton icon="custom-icon-delete"
                                     actionListener="#{skillsDataBean.deleteModernLanguage(ml)}"
                                     update="@form">
                        <p:confirm header="Confirma"
                                   message="Sunteti sigur ca doriti stergerea de limbei moderne?"
                                   icon="ui-icon-alert"/>
                    </p:commandButton>

                </p:column>
            </p:dataTable>
        </util:dataTableWrapper>
    </h:form>

</ui:composition>